package marioarena;
import marioarena.ui.UserInterface;


public class ServerTimer extends Thread{
	private boolean continueTimer = false;
	private final int tick = 1000; // timer tick interval in milliseconds
	private int timePassedInSeconds = 0;
	
	public void startTimer(){
		continueTimer = true;
		this.start();
	}
	public void stopTimer(){
		continueTimer = false;
	}

	@Override 
	public void run(){
		while(continueTimer){
			try{
				Thread.sleep(tick);
				timePassedInSeconds ++;
				UserInterface.updateTimePassed(timePassedInSeconds);
			}catch(Exception e){}
		}
	}
}
